package com.spring.cloud.study.modules.base.controller;

import com.spring.cloud.study.modules.base.entity.SysUserEntity;
import com.spring.cloud.study.modules.base.service.SysUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;

/**
 * 系统用户
 * 
 * @author qidanfeng
 * @email sunlightcs@gmail.com
 * @date 2018-02-01 16:46:47
 */
@RestController
@RequestMapping("/base/sysuser")
public class SysUserController {
	@Autowired
	private SysUserService sysUserService;
	
	/**
	 * 列表
	 */
	@RequestMapping("/list")
	public List<SysUserEntity> list(@RequestParam Map<String, Object> params){
		return  sysUserService.queryList(params);
	}
	
	
	/**
	 * 信息
	 */
	@RequestMapping("/info/{userId}")
	public SysUserEntity info(@PathVariable("userId") String userId){
		SysUserEntity sysUser = sysUserService.queryObject(userId);
		System.out.println("=================服务2=====================");
		return sysUser;
	}
	
	/**
	 * 保存
	 */
	@RequestMapping("/save")
	public String save(@RequestBody SysUserEntity sysUser){
		sysUserService.save(sysUser);
		
		return "OK";
	}
	

	/**
	 * 删除
	 */
	@RequestMapping("/delete")
	public String delete(@RequestBody String[] userIds){
		sysUserService.deleteBatch(userIds);
		
		return "OK";
	}

}
